<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('获取团长')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input name="ylType" value="1" type="hidden">
                    <input name="status" value="1" type="hidden">
                    <div class="select-list">
                        <ul>
                            <li>
                                服务商编号：
                                <input type="text" name="agentNum"/>
                            </li>
                            <li>
                                服务商名称：
                                <input type="text" name="agentName"/>
                            </li>
                            <li>
                                服务商状态：
                                <select name="agentStatus">
                                    <option value="0">正常</option>
                                    <option value="5">服务商注销</option>
                                    <option value="6">已禁用</option>
                                </select>
                            </li>
                            <li class="select-time" style="margin-left: 11px">
                                <label>创建时间： </label>
                                <input type="text" class="time-input"  placeholder="开始时间" name="begin_valid"/>
                                <span>-</span>
                                <input type="text" class="time-input"  placeholder="结束时间" name="end_valid"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var datas = [[${@dict.getType('agent_status')}]];
        var editFlag = [[${@permission.hasPermi('agentInfo:agentInfo:edit')}]];
        var prefix = ctx + "team/teamYlInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "选择团长",
                clickToSelect:true,
                queryParams:queryParams,
                columns: [{
                    radio: true
                },
                {
                    field: 'teamYlId',
                    title: '团队编号'
                },
                {
                    field: 'ylId',
                    title: '团长编号'
                },
                {
                    field: 'ylName',
                    title: '团长名称'
                },
                {
                    field: 'agentNum',
                    title: '展业端管理编号'
                },
                {
                    field: 'agentName',
                    title: '展业端管理名称'
                },
               ]
            };
            $.table.init(options);
        });
        function submitHandler(index, layero) {
            var rows = $.table.selectFirstColumns();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录");
                return;
            }
            $.modal.close();
            // 父页面的变量

            parent.$('#agentNum').val($.table.selectColumns("agentNum"));
            parent.$('#agentName').val($.table.selectColumns("agentName"));
            parent.$('#teamYlId').val($.table.selectColumns("teamYlId"));
            parent.$('#ylId').val($.table.selectColumns("ylId"));
        }


        /**
         * 设置查询参数
         * 只查询团长的信息
         */
        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.ylType = "1";
            search.status = "1";
            return search;
        }

    </script>
</body>
</html>